-
Notifications
You must be signed in to change notification settings - Fork 32
🎨 No more long running http requests while stopping services #8531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎨 No more long running http requests while stopping services #8531
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8531 +/- ##
==========================================
- Coverage 87.52% 87.33% -0.20%
==========================================
Files 2010 1578 -432
Lines 78561 65665 -12896
Branches 1349 682 -667
==========================================
- Hits 68762 57349 -11413
+ Misses 9395 8075 -1320
+ Partials 404 241 -163
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
🧪 CI InsightsHere's what we observed from your CI run for e341566. ✅ Passed Jobs With Interesting Signals
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the dynamic service stop mechanism to use an asynchronous polling approach instead of long-running HTTP connections. The stop operation now returns immediately and monitors the service status until it reaches an idle
state. For legacy services that may take up to 1 hour to stop, the dynamic-scheduler creates fire-and-forget tasks to handle the stopping process without blocking.
Key changes:
- Webserver now polls service status after initiating stop instead of waiting on a long HTTP connection
- Dynamic-scheduler uses fire-and-forget tasks for legacy service stops that may take extended time
- Removed timeout parameter from RPC interface as stops are now non-blocking
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
services/web/server/src/simcore_service_webserver/dynamic_scheduler/api.py | Implements polling mechanism to wait for service to become idle after stop request |
services/dynamic-scheduler/tests/unit/api_rpc/test_api_rpc__services.py | Removes timeout_s parameter from stop_dynamic_service test calls |
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/fire_and_froget.py | Adds new FireAndForgetCollection to manage background tasks |
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/director_v2/_public_client.py | Adds cleanup of public client from app state |
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/common_interface.py | Distinguishes legacy vs new-style services and uses fire-and-forget for legacy stops |
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/catalog/_public_client.py | Renames get_services_labels to get_service_labels |
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/core/events.py | Registers fire_and_forget_lifespan |
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/api/frontend/routes_external_scheduler/_service.py | Removes unused timeout_s parameter from service_stop |
services/director-v2/src/simcore_service_director_v2/core/dynamic_services_settings/scheduler.py | Updates comment to clarify timeout applies to LEGACY services |
services/director-v2/src/simcore_service_director_v2/api/routes/dynamic_services.py | Removes polling logic from stop endpoint as it's now handled by caller |
packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/dynamic_scheduler/services.py | Removes timeout_s parameter from stop_dynamic_service RPC interface |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/fire_and_froget.py
Outdated
Show resolved
Hide resolved
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/fire_and_forget.py
Show resolved
Hide resolved
...ler/src/simcore_service_dynamic_scheduler/api/frontend/routes_external_scheduler/_service.py
Outdated
Show resolved
Hide resolved
...ices/director-v2/src/simcore_service_director_v2/core/dynamic_services_settings/scheduler.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/fire_and_forget.py
Show resolved
Hide resolved
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/common_interface.py
Outdated
Show resolved
Hide resolved
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/core/events.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx. Left some comments.
I recommend you to cleanup naming typos, scheck suggestions and I would also make sure has a good test coverage
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/core/events.py
Outdated
Show resolved
Hide resolved
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/common_interface.py
Outdated
Show resolved
Hide resolved
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/fire_and_forget.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/dynamic_scheduler/api.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/common_interface.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/dynamic_scheduler/api.py
Show resolved
Hide resolved
@Mergifyio queue |
🛑 Configuration not compatible with a branch protection settingThe branch protection setting |
|
What do these changes do?
Changes how the stop procedure works. It no longer involves long running http connections.
Stop returns immediately and the status of the service is monitor until it becomes
idle
, marking the removal of the service.This approach works for both legacy and new style dynamic services.
The
dynamic-scheduler
now creates a fire_and_forget task to deal with stopping legacy services, since it is still required to wait to up to 1 hour for these to finish stopping.Related issue/s
How to test
Dev-ops